package com.ibeeking.gmc.global.api.feign;

import com.ibeeking.found.common.entity.AreaDTO;

import com.ibeeking.found.common.entity.TenantDetailDTO;
import com.ibeeking.found.common.entity.TenantExtendInfo;
import com.ibeeking.gmc.global.api.common.dto.TenantBankDTO;
import com.ibeeking.gmc.global.api.common.dto.TenantDTO;
import com.ibeeking.gmc.global.api.common.dto.TenantEnterpriseInfoDTO;
import com.ibeeking.gmc.global.api.common.dto.TenantLegalInfoDTO;
import com.ibeeking.gmc.global.api.common.param.*;
import com.ibeeking.gmc.global.api.feign.fallback.GlobalTenantFeignFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import com.ibeeking.gmc.global.api.common.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "gmc-global-g-server", contextId = "globalTenantFeignClient", path = "/g", fallbackFactory = GlobalTenantFeignFallbackFactory.class, decode404 = true)
public interface GlobalTenantFeignClient {
    
    /* 中国地理区域 */

    /**
     * 根据编码查询名称
     *
     * @param code 地区编码
     * @return code
     */
    @PostMapping(value = "/area/feign/v1/queryName/{code}")
    ResponseResult<AreaDTO> queryName(@PathVariable("code") String code);

    /**
     * 根据编码查询名称
     *
     * @param codes 编码列表
     * @return 返回
     */
    @PostMapping(value = "/area/feign/v1/queryNames")
    ResponseResult<List<AreaDTO>> queryNames(@RequestBody List<String> codes);

    /**
     * 使用id查询租户信息
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/tenant/feign/v1/queryTenantById/{id}")
    ResponseResult<TenantDTO> queryTenantById(@PathVariable("id") Integer id);
    /**
     * 使用id查询租户信息
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/tenant/feign/v1/queryTenantIndustryById/{id}")
    ResponseResult<String> queryTenantIndustryById(@PathVariable("id") Integer id);

    /**
     * 使用id查询租户详细信息
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/tenant/feign/v1/queryDetailByTenantId/{type}/{id}")
    ResponseResult<TenantDetailDTO> queryDetailByTenantId(@PathVariable("type") Integer type, @PathVariable("id") Integer id);
    /**
     * 更新租户扩展信息
     *
     * @param extendInfo
     * @return
     */
    @PostMapping(value = "/tenant/feign/v1/updateTenantExtendInfo")
    ResponseResult<Boolean> updateTenantExtendInfo(@RequestBody @Validated TenantExtendInfo extendInfo);
    /**
     * 修改租户详细信息
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/tenant/feign/v1/addOrUpdateTenantDetail")
    ResponseResult<Boolean> addOrUpdateTenantDetail(@RequestBody @Validated TenantDetailParam param);

    /**
     * 修改开户行信息
     *
     * @param tenantBankParam
     * @return
     */
    @PostMapping(value = "/tenantbank/feign/v1/modifyBank")
    ResponseResult<Boolean> modifyBank(@RequestBody @Validated TenantBankParam tenantBankParam);

    /**
     * 查询开户行信息
     *
     * @param id
     * @return
     */
    @PostMapping(value = "/tenantbank/feign/v1/queryTenantBankByTenantId/{id}")
    ResponseResult<TenantBankDTO> queryTenantBankByTenantId(@PathVariable("id") Integer id);


    /**
     * 查询企业信息
     *
     * @param id
     * @return
     */
    @PostMapping("/enterpriseinfo/feign/v1/queryEnterpriseInfoByTenantId/{id}")
    ResponseResult<TenantEnterpriseInfoDTO> queryEnterpriseInfoByTenantId(@PathVariable("id") Integer id);

    /**
     * 修改企业信息
     *
     * @param tenantEnterpriseInfoParam
     * @return
     */
    @PostMapping("/enterpriseinfo/feign/v1/modifyEnterpriseInfo")
    ResponseResult<Boolean> modifyEnterpriseInfo(@RequestBody @Validated TenantEnterpriseInfoParam tenantEnterpriseInfoParam);


    /**
     * 查询法人信息
     *
     * @param id
     * @return
     */
    @PostMapping("/enterpriseinfo/feign/v1/queryLegalInfoByTenantId/{id}")
    ResponseResult<TenantLegalInfoDTO> queryLegalInfoByTenantId(@PathVariable("id") Integer id);

    /**
     * 修改法人信息
     *
     * @param tenantLegalInfoParam
     * @return
     */
    @PostMapping("/tenant/feign/v1/modifyLegalInfo")
    ResponseResult<Boolean> modifyLegalInfo(@RequestBody @Validated TenantLegalInfoParam tenantLegalInfoParam);


    @PostMapping("/tenant/feign/v1/modifyTenant")
    ResponseResult<Boolean> modifyTenant(@RequestBody @Validated TenantParam tenantParam);

}
